<%@ page import="com.hzqy.web.vo.PmsOrgVo" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.Date" %>
<%@ page import="com.hzqy.web.login.SessionKey" %>
<%@ page language="java" contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="Page-Enter" content="blendTrans(Duration=1.0)"/>
    <meta name="page-view-size" content="1280*720" />
    <title>首页</title>
    <%@include file="commons.jsp" %>
    <%@ include file="../../../../commons/turnPage.jsp" %>
    <%@ include file="../../../../commons/common_css_js.jsp" %>
    <%@ include file="../../../../commons/commons_data.jsp" %>
    <%@ include file="commons_category.jsp" %>
    <%
        // 取组织
        String name="";
        String logoPic ="imgs/index/logo.png";
        try{
            PmsOrgVo pmsOrgVo = (PmsOrgVo)session.getAttribute(SessionKey.SESSION_USER_FOR_ORG_INFO);
            if(pmsOrgVo!=null){
                name=pmsOrgVo.getF_po_name();
                if(pmsOrgVo.getF_po_logpicurl()!=null){
                    logoPic=pic_url+pmsOrgVo.getF_po_logpicurl();
                }
            }
        }catch(Exception e){
        }
        //按钮个数及定位按钮位置
        String Num = request.getParameter("Num");
        TurnPage tp = new TurnPage(request,session);
        HashMap<String,String> tpHash = tp.isPreUrl(String.valueOf(request.getParameter("Num")));
        if(Num==null||"".equals(Num)){
            Num = tp.getValue(tpHash,"Num","","1");
        }
        Date now=new Date();
        SimpleDateFormat f=new SimpleDateFormat("yyyy-MM-dd");
        String date=f.format(now);

    %>
    <style type="text/css">
        *{
            margin: 0;
            padding: 0;

        }
        body {
            background-size: 1280px 720px;
            background-repeat:no-repeat;
            background-color:transparent;
        }
        .nav{
            position: absolute;
            z-index:40;
            text-align: center;
            top: 521px;
            left: 60px;
            width:739px;
            height: 30px;
        }

    </style>
</head>
<body >
	<div style="position:absolute;z-index:1;left:0;top:0px;"><img src="imgs/index/blackGold/gold_ditu.png"/></div>
	<div style="position:absolute;z-index:10;left:30px;top:20px;width: 75px;height: 60px"><img src="<%=logoPic%>" width="75" height="60"/></div>
	<div style="position:absolute;z-index:10;left:118px;top:34px;font-size:28px;font-weight:bold;font-family:MicrosoftYaHei;color:rgb(226,194,128)"><%=name%></div>
	<div style="position:absolute;z-index:10;left:614px;top:35px;overflow:hidden;width: 350px"><marquee id="scrolltext" style="font-size:20px;color:white;font-family:'Microsoft YaHei'" scrollamount="5"></marquee></div>
	<div id="pic" style="position:absolute;z-index:10;left:60px;top:162px;"><img src="imgs/index/dot.gif" width="739" height="415"/></div>
	<div id="point" class="nav" ></div>
    <div id="point_foc"></div>

    <div id="time" style="position:absolute;z-index:10;left:922px;top:220px;font-size:76px;color: white;font-family:Microsoft YaHei"></div>
	<div id="date" style="position:absolute;z-index:10;left:855px;top:325px;font-size:26px;color: white;font-family:Microsoft YaHei"></div>
	<div id="week" style="position:absolute;z-index:10;left:1087px;top:325px;font-size:26px;color: white;font-family:Microsoft YaHei"></div>
	<div id="temperature" style="position:absolute;z-index:10;left:866px;top:368px;font-size:26px;color: white;font-family:Microsoft YaHei"></div>
	<div id="weather" style="position:absolute;z-index:10;left:1070px;top:368px;font-size:26px;color: white;font-family:Microsoft YaHei"></div>
    <div id="btns"></div>

	<script type="text/javascript">
	 var relativePathPrefix ="../../../../";
     var pic_url = "<%=pic_url%>";
     var Num = parseInt("<%=Num%>");
     var focusId = null;
     var navList = null;
     function startBgPlay(bgArr) {
         var bg_img = document.getElementById("pic").childNodes[0];
         var str="";
         var str1="";

         if (bgArr && bgArr.length > 1) {
             for(var i=0;i<bgArr.length;i++){
                 str+="<img id='nav"+i+"' src='imgs/index/grayBlack/point.png' style='margin: 0 15px' width='45' height='45'/>";
             }
             for(var i=0;i<Math.floor(bgArr.length/2);i++){
                 var len = bgArr.length;
                 var center = 60+739/2;
                 var margins=30; //外边距*2
                 var bianchang = 45;
                 var left1=center-((len-2*i)/2*bianchang+(len-2*i-1)/2*margins)+(382-369);
                 var left2=center+(((len-2*i)/2*bianchang+(len-2*i-1)/2*margins)-45)+(382-369);
                 str1+="<div id='nav_focus"+i+"' style='position: absolute;left:"+left1+"px;top:532px;z-index: 70;display: none'><img src='imgs/index/grayBlack/ponit_foc.png' width='19' height='19'/> </div>";
                 str1+="<div id='nav_focus"+(len-i-1)+"' style='position: absolute;left:"+left2+"px;top:532px;z-index: 70;display: none'><img src='imgs/index/grayBlack/ponit_foc.png' width='19' height='19'/> </div>";
             }
             if((bgArr.length%2)!=0){
                 str1+="<div id='nav_focus"+Math.floor(bgArr.length/2)+"' style='position: absolute;left:"+(center-bianchang/2+(382-369))+"px;top:532px;z-index: 70;display: none'><img  src='imgs/index/grayBlack/ponit_foc.png'  width='19' height='19'/></div>";
             }
             document.getElementById("point").innerHTML=str;
             document.getElementById("point_foc").innerHTML=str1;

             var currentIndex = 0;// 当前图片
             var preIndex=-1;  //前一个图片
             bg_img.src = pic_url + bgArr[currentIndex].f_cc_picurl;
             document.getElementById("nav_focus"+currentIndex).style.display="block";
             setInterval(function(){
                 currentIndex ++;
                 preIndex ++;
                 if (currentIndex >= bgArr.length) {
                     currentIndex = 0;
                 }
                 if (preIndex >= bgArr.length) {
                     preIndex = 0;
                 }
                 bg_img.src = pic_url + bgArr[currentIndex].f_cc_picurl;
                 if(currentIndex==0){
                     document.getElementById("nav_focus"+(bgArr.length-1)).style.display="none";
                 }else{
                     document.getElementById("nav_focus"+(currentIndex-1)).style.display="none";
                 }
                 document.getElementById("nav_focus"+currentIndex).style.display="block";
             }, 10000);
         } else if (bgArr.length == 1){
              bg_img.src = pic_url + bgArr[0].f_cc_picurl;
         } else {
             bg_img.src = "imgs/secondpage/grayGold/pic.png";
         }
     }
		 window.onload = function() {
	         showtime();
             //天气
	       /*  var paramJson={};
             paramJson.f_wfc_provinceid='';
             paramJson.f_wfc_source="CN101020900";
             paramJson.f_wfc_type="0";
             paramJson.disabledAreaid="1";
             paramJson.f_wfc_date='<%=date%>';
	         selectWeatherForecastCommonVo(relativePathPrefix,paramJson,content.getWeather);*/
             //滚动条
	         var paramJson1={};
	         paramJson1.id="<%=CategoryUtils.MARQUEE_TEXT%>";
	         paramJson1.startindex = 0;
	         paramJson1.count = 1;
	         paramJson1.f_cp_cprid = "2";
	         paramJson1.ispublic = ispublicModel;
	         getCatalogContentListById(relativePathPrefix,paramJson1,content.getCotnentMerquee);

             //图片轮播
	         /*var paramJson3={};
	         paramJson3.id="<%=CategoryUtils.BG_IMG%>";
	         paramJson3.startindex = 0;
	         paramJson3.count = 100;
	         paramJson3.f_cp_cprid = "2";
	         paramJson3.ispublic = ispublicModel;
	         getCatalogContentListById(relativePathPrefix,paramJson3,content.getImg);*/
             document.getElementById("pic").childNodes[0].src="imgs/index/gg3.png";
	         //按钮数量
	         var paramJson4={};
	         paramJson4.f_catalog_id = "<%=CategoryUtils.CATEGORY_PARENT_ID%>";
	         paramJson4.pageNo = 0;
	         paramJson4.pageSize = 5;
	         paramJson4.f_is_public = ispublicModel;
	         catalog_catalogInfoListByparamJson(relativePathPrefix,paramJson4,content.getHotelCategoryList);
	     };

         function btnFocus(id) {
            document.getElementById(id).style.display="block";
         }
         function unFocus(id) {
             document.getElementById(id).style.display="none";
         }
		 function showtime(){
            var today;
            var hour;
            var second;
            var minute;
            var year;
            var month;
            var date;
            var strDate;
            today=new Date();
            var n_day = today.getDay();
            switch (n_day){
                case 0:{
                    strDate = "星期日"
                }break;
                case 1:{
                    strDate = "星期一"
                }break;
                case 2:{
                    strDate = "星期二"
                }break;
                case 3:{
                    strDate = "星期三"
                }break;
                case 4:{
                    strDate = "星期四"
                }break;
                case 5:{
                    strDate = "星期五"
                }break;
                case 6:{
                    strDate = "星期六"
                }break;
                case 7:{
                    strDate = "星期日"
                }break;
            }
            year = today.getFullYear();
            month = today.getMonth()+1;
            date = today.getDate();
            hour = today.getHours();
            minute =today.getMinutes();
            second = today.getSeconds();
            if(month<10) month="0"+month;
            if(date<10) date="0"+date;
            if(hour<10) hour="0"+hour;
            if(minute<10) minute="0"+minute;
            if(second<10) second="0"+second;

            document.getElementById("week").innerHTML=strDate;
            document.getElementById("date").innerHTML=year+"-"+month+"-"+date;
            document.getElementById("time").innerHTML=hour+":"+minute;
            setTimeout(function() {
                showtime();
            }, 1000);
        }
		 var content = {
             getWeather: function (__xmlhttp) {
                 try {
                     var jsonn;
                     jsonn = Josncheck(__xmlhttp.responseText);

                     if ("" != jsonn && "" != jsonn[0]) {
                         document.getElementById("temperature").innerHTML = (jsonn[0].f_wfc_minTemperature ? jsonn[0].f_wfc_minTemperature + '℃' : '') + "~" + (jsonn[0].f_wfc_maxTemperature ? jsonn[0].f_wfc_maxTemperature + '℃' : '');
                         document.getElementById("weather").innerHTML = (jsonn[0].f_wfc_weather ? jsonn[0].f_wfc_weather : '暂无天气');
                     }else{
                         document.getElementById("temperature").innerHTML = '暂无温度';
                         document.getElementById("weather").innerHTML = '暂无天气';
                     }

                 } catch (e) {
                 }
             },
             getCotnentMerquee: function (__xmlhttp) {
                 var json;
                 json = Josncheck(__xmlhttp.responseText);
                 if (json && json[0] && json[0].f_cc_desc) {
                    // document.getElementById("scrolltext").innerHTML = json[0].f_cc_desc.replace(/<[^>]+>/g, "").replace(/(_ueditor_page_break_tag_)/g, "");
                     document.getElementById("scrolltext").innerHTML="南苑酒店欢迎您!"
                 }
             },

             getImg: function (__xmlhttp) {
                 var json;
                 json = Josncheck(__xmlhttp.responseText);
                 if (json && json[0]) {
                     startBgPlay(json);
                 }
             },

             getHotelCategoryList: function (__xmlhttp) {
                 var json;
                 json =  Josncheck(__xmlhttp.responseText);
                 navList = json;
                 if (json && json[0]) {
                     show(json.length);
                 }
             }
         }
         function go_watch_tv() {
             for (var i = 0; i < navList.length; i++) {
                 var json = navList[i];
                 if (json.f_catalog_desc && json.f_catalog_desc.indexOf('jumpepg') >= 0) {
                     go_to_watch_tv(json.f_catalog_desc);
                 }
             }
         }
         function go_to_url(i,len) {
             if (navList[i].f_catalog_desc && navList[i].f_catalog_desc.indexOf('jumpepg') >= 0) {
                 window.location.href="jump_epg.jsp";
             }else{
                 window.location.href="secondpage.jsp?Num="+(len-i)+"&catalogId="+navList[i].f_catalog_id;
             }
         }
         //按钮图片
         function show(len){
             var str='';
             if(len==1){
                 str+='<div id="btn1" style="display:block"> <a id="one" style="position:absolute;z-index:40;left: 814px;top: 449px; width: 407px;height: 128px" href="javascript:go_to_url(0,1)" onfocus="btnFocus(\'one_button\')" onblur="unFocus(\'one_button\')">' ;
                 str+='<img src="'+(pic_url+navList[0].f_cp_url)+'" width="407" height="128"/></a>';
                 str+='<div id="one_button" style="position: absolute;z-index:80;left: 802px;top: 437px;display: none"><img src="imgs/index/one_button/gold_focus.png"/></div></div>';
                 focusId="one";
             }else if(len==2){
                 str+='<div id="btn2" style="display:block"> <a id="two_1" style="position:absolute;z-index:40;left: 814px;top: 449px; width: 198px;height: 128px" href="javascript:go_to_url(1,2)" onfocus="btnFocus(\'two_button_1\')" onblur="unFocus(\'two_button_1\')">';
                 str+='<img src="'+(pic_url+navList[1].f_cp_url) +'" width="198" height="128"/> </a>';
                 str+='<div id="two_button_1" style="position: absolute;z-index:80;left: 802px;top: 437px;display: none"><img src="imgs/index/two_button/gold_focus.png" alt=""></div>';
                 str+='<a id="two_2" style="position:absolute;z-index:40;left: 1023px;top: 449px; width: 198px;height: 128px" href="javascript:go_to_url(0,2)" onfocus="btnFocus(\'two_button_2\')" onblur="unFocus(\'two_button_2\')"><img src="'+(pic_url+navList[0].f_cp_url)+'" width="198" height="128"/></a>';
                 str+='<div id="two_button_2" style="position: absolute;z-index:80;left: 1011px;top: 437px;display: none"><img src="imgs/index/two_button/gold_focus.png" alt=""></div></div>';
                 focusId="two_"+Num;
             }else if(len==3){
                 str+='<div id="btn3" style="display:block"><a id="three_1" style="position:absolute;z-index:40;left: 814px;top: 449px; width: 128px;height: 128px" href="javascript:go_to_url(2,3)" onfocus="btnFocus(\'three_button_1\')" onblur="unFocus(\'three_button_1\')">';
                 str+='<img src="'+(pic_url+navList[2].f_cp_url)+'" width="128" height="128"/></a>';
                 str+='<div id="three_button_1" style="position: absolute;z-index:80;left: 802px;top: 437px;display: none"><img src="imgs/index/three_button/gold_focus.png"></div>';
                 str+='<a id="three_2" style="position:absolute;z-index:40;left: 954px;top: 449px; width: 128px;height: 128px" href="javascript:go_to_url(1,3)" onfocus="btnFocus(\'three_button_2\')" onblur="unFocus(\'three_button_2\')">' ;
                 str+='<img src="'+(pic_url+navList[1].f_cp_url)+'" width="128" height="128"/></a>';
                 str+='<div id="three_button_2" style="position: absolute;z-index:80;left: 942px;top: 437px;display: none"><img src="imgs/index/three_button/gold_focus.png" alt=""></div>';
                 str+='<a id="three_3" style="position:absolute;z-index:40;left: 1093px;top: 449px; width: 128px;height: 128px" href="javascript:go_to_url(0,3)" onfocus="btnFocus(\'three_button_3\')" onblur="unFocus(\'three_button_3\')"><img src="'+(pic_url+navList[0].f_cp_url)+'" width="128" height="128"/></a>';
                 str+='<div id="three_button_3" style="position: absolute;z-index:80;left: 1081px;top: 437px;display: none"><img src="imgs/index/three_button/gold_focus.png" ></div></div>'
                 focusId="three_"+Num;
             }else if(len==4){
                 str+='<div id="btn4" style="display: block">';
                 str+='<a id="four_1" style="position:absolute;z-index:40;left: 814px;top: 449px; width: 198px;height: 60px" href="javascript:go_to_url(3,4)" onfocus="btnFocus(\'four_button_1\')" onblur="unFocus(\'four_button_1\')"><img src="'+(pic_url+navList[3].f_cp_url) +'" width="198" height="60"/></a>';
                 str+='<div id="four_button_1" style="position: absolute;z-index:80;left: 802px;top: 437px;display: none"><img src="imgs/index/four_button/gold_focus.png" alt=""></div>';
                 str+='<a id="four_2" style="position:absolute;z-index:40;left: 1023px;top: 449px; width: 198px;height: 60px" href="javascript:go_to_url(2,4)" onfocus="btnFocus(\'four_button_2\')" onblur="unFocus(\'four_button_2\')"><img src="'+(pic_url+navList[2].f_cp_url)+'" width="198" height="60"/></a>';
                 str+='<div id="four_button_2" style="position: absolute;z-index:80;left: 1011px;top: 437px;display: none"><img src="imgs/index/four_button/gold_focus.png" alt=""></div>';
                 str+='<a id="four_3" style="position:absolute;z-index:40;left: 814px;top: 517px; width: 198px;height: 60px" href="javascript:go_to_url(1,4)" onfocus="btnFocus(\'four_button_3\')" onblur="unFocus(\'four_button_3\')"><img src="'+ (pic_url+navList[1].f_cp_url) +'" width="198" height="60"/></a>';
                 str+='<div id="four_button_3" style="position: absolute;z-index:80;left: 802px;top: 505px;display: none"><img src="imgs/index/four_button/gold_focus.png" alt=""></div>';
                 str+='<a id="four_4" style="position:absolute;z-index:40;left: 1023px;top: 517px; width: 198px;height: 60px" href="javascript:go_to_url(0,4)" onfocus="btnFocus(\'four_button_4\')" onblur="unFocus(\'four_button_4\')"><img src="'+(pic_url+navList[0].f_cp_url) +'" width="198" height="60"/></a>';
                 str+='<div id="four_button_4" style="position: absolute;z-index:80;left: 1011px;top: 505px;display: none"><img src="imgs/index/four_button/gold_focus.png" alt=""></div></div>';
                 focusId="four_"+Num;
             }else{
             }
             document.getElementById("btns").innerHTML=str;
             document.getElementById(focusId).focus();

         }
		 function grabEvent(evt) {
             var keycode = event.which ? event.which : event.keyCode;
             if(keycode == 8){
                 window.location.reload();
             }
         }
         document.onkeypress=grabEvent;
         document.onirkeypress=grabEvent;
		
		 
	</script>
</body>
</html>